﻿<%@ Import Namespace="Model"%>
<%@ Import Namespace="Service"%>
<%@ Import Namespace="System.Net.Mime"%>
<%@ Import Namespace="System.Data"%>
<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
    
    int userlocation;
    DirectServiceHome _DirectService = new DirectServiceHome();
    protected void Page_Load(object sender, EventArgs e)
    {
        // userlocation = Int32.Parse( Request.ServerVariables["REMOTE_ADDR"].Substring(7, 1));
        
        Session["userFullDomain"] = Request.ServerVariables["LOGON_USER"];
        Employee employee = new Employee();
        employee = new ReferenceDataService().GetEmployeeByDomainName(Request.ServerVariables["LOGON_USER"]);
        Session["GroupId"] = employee.GroupId;
        
        
        DataTable table = new DataTable();
        table =_DirectService.ShowEquipmentSupply();
        string strMessageHeader ="0";
        if (table.Rows.Count != 0)
        {
            lblEmployee.Text = "Welcome " + table.Rows[0]["EMPLOYEENAME"].ToString();
             for(int i=0;i<table.Rows .Count;i++)
             {
                 strMessageHeader += table.Rows[i]["CODENUMBER"].ToString()+ " ";
                 strMessageHeader += table.Rows[i]["DESCRIPTIONEQUIPMENT"].ToString();
             }
        }
        // lblMessageHeader.Text = strMessageHeader; Label for show all value from codeNumber on Header page.
        GreateTable();
        ShowWelcome();    
    }
    private void GreateTable()
    {

        DataTable table = new DataTable();
        table = _DirectService.ShowEquipmentSupply();
        if(table.Rows.Count !=0)
        {
            foreach (DataRow dtr in  table.Rows)
            {
                string codenumber = dtr[0].ToString();
                Response.Write("<tr>");
                Response.Write("<td><a href=worOrderRequestIntranet.aspx?codenumber=" + codenumber
                    + ">");
                Response.Write(codenumber);
                Response.Write("</td>");
                Response.Write("<td><a href=worOrderRequestIntranet.aspx?codenumber=" + codenumber
                    + ">");
                Response.Write(dtr[1].ToString());
                Response.Write("</td>");
                Response.Write("</tr>");
            }
        }            
    }
    private void ShowWelcome()
    { 
        if ((userlocation == 28) || (userlocation == 29))
        {
            lblLocation.Text = "PHNOM PENH";
            this.lblAddressDetails.Text = "CAMS Cambodia Airport Management Services Phonom Penh International Airports " +
                "P.O. Box 1256 National Road #4 Phnom Penh Kingdom of Cambodia ";
            this.lblContactTel.Text = "IT hotline: 023 890 520, Ext: 1555";
            this.lblContactEmail.Text = "E-mail: pnh.it.support@cambodia-airports.aero";
        }
        else if (userlocation == 30)
        {
            this.lblLocation.Text = "SIEM REAP";
            this.lblAddressDetails.Text = "CAMS Cambodia Airport Management Services Phonom Penh International Airports " +
                "Siem Reap Airport ";
            this.lblContactTel.Text = "IT hotline: 063 xxx xxx, Ext: 2555";
            this.lblContactEmail.Text = "E-mail: rep.it.support@cambodia-airports.aero";
        }
        else if (userlocation == 31)
        {
            this.lblLocation.Text = "KOS";
            this.lblAddressDetails.Text = "KOS Airport";
            this.lblContactTel.Text = "IT hotline: 012 xxx xxx, Ext: xxxx";
            this.lblContactEmail.Text = "E-mail: kos.it.support@cambodia-airports.aero";
        }     
    }
    override protected void OnInit(EventArgs e)
    {
        //
        // CODEGEN: This call is required by the ASP.NET Web Form Designer.
        //
        InitializeComponent();
        base.OnInit(e);
    }

    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {

    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
    <style type="text/css">
        .style1
        {
            height: 23px;
        }
    </style>
</head>
<body>
    <form runat ="server" > 
   <table runat="server"> 
     <%--<tr>
        <td colspan ="2"> 
        <a href="worOrderRequestIntranet.aspx?codeNumber=<%#Eval("CodeNumber")%>" <asp:Label ID="lblMessageHeader" runat ="server" Text ="Link"></asp:Label>
        </td>
        <td></td> // Label for show all value from codeNumber on Header page.
     </tr>--%>
      <tr>
        <td colspan ="2"><asp:Table ID="tblMessageHeader" runat ="server" ></asp:Table></td>
        <td></td>
     </tr>
     
     <tr>
        <td><strong><asp:Label ID="lblContact" runat ="server"  Text ="Contact"></asp:Label></strong></td>
        <td></td>
     </tr>
     <tr>
        <td><asp:Label ID="lblItDepartment" runat ="server" Text ="IT Department"></asp:Label> </td>
        <td></td>
     </tr>
     <tr>
        <td><asp:Label ID="lblLocation" runat ="server" Text ="Label" ></asp:Label></td>
        <td></td>
     </tr>
     <tr>
        <td><asp:Label ID="lblAddressDetails" runat ="server" Text ="Label" ></asp:Label></td>
        <td></td>
     </tr>
     <tr>
        <td class="style1"><asp:Label ID="lblContactTel" runat ="server"  Text ="Label"></asp:Label></td>
        <td class="style1"></td>
     </tr>
     
     <tr>
        <td><asp:Label ID="lblContactEmail" runat ="server" Text ="Label" ></asp:Label></td>
        <td></td>
     </tr>
       <tr>
        <td></td>
        <td><strong><asp:Label ID="lblEmployee" runat ="server" Text ="" ></strong></asp:Label></td>
     </tr>
     
     
    <tr>
    <td  style="width:100px"></td>
        <td style="text-align:left; font-weight: 700;">
        To submit an IT Work order, Please select your correspod EquipmentID or SystemID 
        mentID or SystemID 
        </td>
     </tr>
     
     <tr>
     
      <td  style="width:130px"></td>
        <td style="text-align:center; font-weight: 700;" class="style1">
            Your Equipment are:
        </td>
     </tr>
     <tr  runat="server">
      <td  style="width:130px"></td>
        <td style="text-align:center">
            <asp:GridView ID="grdHomeequipment" runat="server" AllowPaging="True" 
                 
                    AllowSorting="True" AutoGenerateColumns="False" 
                    CssClass="GridItem" DataSourceID="dsHomeEquipment" 
                    RowHeaderColumn="CodeNumber" 
                    width="720px"  DataKeyNames="CodeNumber" PageSize="4" CellPadding="0" 
                    ForeColor="#333333" GridLines="None"
                   >
                   
                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                   
                    <HeaderStyle BorderStyle="None" CssClass="GridViewHeader" Height="20px" 
                        Width="30px" BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <Columns>
                    <%--<a href="worOrderRequestIntranet.aspx?codeNumber=<%#Eval("CodeNumber")%>" > 
                        <asp:BoundField DataField="CodeNumber" HeaderText="CodeNumber" ReadOnly="True" 
                            SortExpression="CodeNumber">
                            <ItemStyle Width="50px" />
                        </asp:BoundField>
                        </a>--%>
                        <asp:TemplateField HeaderText="EquipmentID" SortExpression="CODENUMBER">
                            <ItemTemplate>
                            <a href="worOrderRequestIntranet.aspx?codeNumber=<%#Eval("CodeNumber")%>" > <%# Eval("CODENUMBER")%></a> 
                            </ItemTemplate>
                            <EditItemTemplate>
                                &nbsp;<asp:TextBox ID="textBox0" runat="server" Text='<%# Bind("CODENUMBER") %>' 
                                     Width="200px"></asp:TextBox>
                            </EditItemTemplate>
                            
                            <HeaderStyle HorizontalAlign="Left" />
                            
                            <ItemStyle HorizontalAlign="Left" />
                            
                        </asp:TemplateField>
                        
                         <asp:TemplateField HeaderText="Description" SortExpression="DESCRIPTIONEQUIPMENT">
                            <ItemTemplate>
                            <a href="worOrderRequestIntranet.aspx?codeNumber=<%#Eval("CodeNumber")%>" > <%# Eval("DESCRIPTIONEQUIPMENT")%></a> 
                            </ItemTemplate>
                            <EditItemTemplate>
                                &nbsp;<asp:TextBox ID="textBox0" runat="server" Text='<%# Bind("DESCRIPTIONEQUIPMENT") %>' 
                                     Width="95%"></asp:TextBox>
                            </EditItemTemplate>
                            
                             <HeaderStyle HorizontalAlign="Left" />
                             <ItemStyle HorizontalAlign="Left" />
                            
                        </asp:TemplateField>
                        
                    </Columns>
                   <PagerStyle HorizontalAlign="Center" VerticalAlign="Middle" BackColor="#2461BF" 
                        ForeColor="White" />
                    <EditRowStyle BackColor="#2461BF" />
                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <RowStyle CssClass="AlternativeRowStyle" BackColor="#F7F6F3" />
                    <AlternatingRowStyle BackColor="White" CssClass="AlternativeRowStyle" />
                        
                        
                    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                   <RowStyle BackColor="#EFF3FB" />
                   <SelectedRowStyle BackColor="#FF5050" />
                   <HeaderStyle BorderStyle="None" CssClass="GridViewHeader" Height="20px" 
                        Width="30px" />
                        
                    <PagerStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                    <EditRowStyle BackColor="LightGray" />
                    <RowStyle CssClass="AlternativeRowStyle" />
                    <AlternatingRowStyle BackColor="White" CssClass="AlternativeRowStyle" />

 </asp:GridView>
 
                     <asp:ObjectDataSource ID="dsHomeEquipment" runat="server" 
                SelectMethod="ShowEquipmentSupply" TypeName="DirectServiceHome">
            </asp:ObjectDataSource>
                 </td>
        
     </tr>
     
     
     <tr>
         <td style="height:10px"></td>
         <td></td>
     </tr>
     <tr>
      <td  style="width:130px"></td>
        <td style="text-align:center; font-weight: 700;">
            System code are:
        </td>
     </tr>
     <tr>
         <td  style="width:100px"></td>
         <td style="text-align:center; font-weight: 700;">
        
         <asp:GridView ID="grdHomeSystem" runat="server" AllowPaging="True" 
                 
                    AllowSorting="True" AutoGenerateColumns="False" 
                    CssClass="GridItem" DataSourceID="dsHomesystem" 
                    RowHeaderColumn="CodeNumber" 
                    width="720px"  DataKeyNames="CodeNumber" PageSize="4" CellPadding="0" 
                ForeColor="#333333" GridLines="None"
                   >
                   
                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                   
                    <HeaderStyle BorderStyle="None" CssClass="GridViewHeader" Height="20px" 
                        Width="30px" BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <Columns>
                        <%--<asp:BoundField DataField="CodeNumber" HeaderText="SystemId" ReadOnly="True" 
                            SortExpression="CodeNumber">
                            <ItemStyle Width="50px" />
                        </asp:BoundField>--%>
                        <asp:TemplateField HeaderText="SystemID" 
                            SortExpression="CODENUMBER" ItemStyle-HorizontalAlign="Left"  >
                            <ItemTemplate>
                               <a href="worOrderRequestIntranet.aspx?codeNumber=<%#Eval("CodeNumber")%>"><%# Eval("CODENUMBER")%></a> 
                            </ItemTemplate>
                            <EditItemTemplate>
                                &nbsp;<asp:TextBox ID="textBox0" runat="server" Text='<%# Bind("CODENUMBER") %>' 
                                     ></asp:TextBox>
                            </EditItemTemplate>
                            <ItemStyle Width="300px" />
                            <HeaderStyle HorizontalAlign="Left" />
                            <ItemStyle HorizontalAlign="Left" />
                        </asp:TemplateField>
                        
                         <asp:TemplateField HeaderText="Description" 
                            SortExpression="DESCRIPTIONEQUIPMENT">
                            <ItemTemplate>
                               <a href="worOrderRequestIntranet.aspx?codeNumber=<%#Eval("CodeNumber")%>"><%# Eval("DESCRIPTIONEQUIPMENT")%></a> 
                            </ItemTemplate>
                            <EditItemTemplate>
                                &nbsp;<asp:TextBox ID="textBox0" runat="server" Text='<%# Bind("DESCRIPTIONEQUIPMENT") %>' 
                                     Width="95%"></asp:TextBox>
                            </EditItemTemplate>
                             <HeaderStyle HorizontalAlign="Left" BorderStyle="None" />
                             <ItemStyle HorizontalAlign="Left" />
                        </asp:TemplateField>
                        
                    </Columns>
                   <PagerStyle HorizontalAlign="Center" VerticalAlign="Middle" BackColor="#2461BF" 
                        ForeColor="White" />
                    <EditRowStyle BackColor="#2461BF" />
                    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <RowStyle CssClass="AlternativeRowStyle" BackColor="#EFF3FB" />
                    <AlternatingRowStyle BackColor="White" CssClass="AlternativeRowStyle" />
 </asp:GridView>
         
         
             <asp:ObjectDataSource ID="dsHomesystem" runat="server" 
                 SelectMethod="ShowSystem" TypeName="DirectServiceHome">
             </asp:ObjectDataSource>
         
         
         </td>
     </tr>
   </table>
   </form>
      
</body>
</html>
